/*!
\copyright  Copyright (c) 2023-2025 Qualcomm Technologies International, Ltd.\n
            All Rights Reserved.\n
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file		kymera_broadcast_concurrency.h
\defgroup   kymera Kymera
\ingroup    audio_domain
\brief      The Kymera Broadcast Concurrency Manager API

*/

#ifndef KYMERA_BROADCAST_CONCURRENCY_H
#define KYMERA_BROADCAST_CONCURRENCY_H

#include "kymera_data.h"

#define KymeraBroadcastConcurrency_IsAudioBroadcasting() (KymeraBroadcastConcurrency_GetLeAudioBroadcastingStatus())

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Get the default LEA broadcast config parameters which shall be used in concurrency use-case

    \param[in] audio_source routed audio source.

    \returns le_media_config_t pointer to LEA broadcast params.
*/
le_media_config_t* KymeraBroadcastConcurrency_GetLeAudioBroadcastParams(audio_source_t audio_source);
#else
#define KymeraBroadcastConcurrency_GetLeAudioBroadcastParams(audio_source) (UNUSED(audio_source))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Handle broadcast source reconfiguration when source is changed in broadcast concurrency use-cases
*/
void KymeraBroadcastConcurrency_HandleBroadcastSourceReconfiguration(void);
#else
#define KymeraBroadcastConcurrency_HandleBroadcastSourceReconfiguration() ((void)(0))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Configure broadcast splitter in order to provide additional inputs to the To-Air chain.
*/
void KymeraBroadcastConcurrency_ConfigureBroadcastSplitter(void);
#else
#define KymeraBroadcastConcurrency_ConfigureBroadcastSplitter() ((void)(0))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Configure audio chain(resampler, transcoding chain or TTP Latency buffer) to support
 *         broadcast concurrency use cases.
*/
void KymeraBroadcastConcurrency_ConfigureChain(uint32 rate);
#else
#define KymeraBroadcastConcurrency_ConfigureChain(rate) (UNUSED(rate))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Create To-Air(ISO) chain based on the broadcast params.
*/
void KymeraBroadcastConcurrency_CreateToAirChain(void);
#else
#define KymeraBroadcastConcurrency_CreateToAirChain() ((void)(0))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Configure To-Air(ISO) chain based on the broadcast params.
*/
void KymeraBroadcastConcurrency_ConfigureToAirChain(void);
#else
#define KymeraBroadcastConcurrency_ConfigureToAirChain() ((void)(0))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Join To-Air(ISO) chain to the input chain & ISO sink.
*/
void KymeraBroadcastConcurrency_JoinToAirChain(void);
#else
#define KymeraBroadcastConcurrency_JoinToAirChain() ((void)(0))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Start To-Air(ISO) chain.
*/
void KymeraBroadcastConcurrency_StartToAirChain(void);
#else
#define KymeraBroadcastConcurrency_StartToAirChain() ((void)(0))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Disconnect To-Air(ISO) chain from input chain and ISO sink.
*/
void KymeraBroadcastConcurrency_DisconnectToAirChain(void);
#else
#define KymeraBroadcastConcurrency_DisconnectToAirChain() ((void)(0))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Destroy To-Air(ISO) chain.
*/
void KymeraBroadcastConcurrency_DestroyToAirChain(void);
#else
#define KymeraBroadcastConcurrency_DestroyToAirChain() ((void)(0))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Initialize LEA broadcast params.
*/
void KymeraBroadcastConcurrency_InitializeLeaBroacastParams(const appKymeraLeAudioBroadcastParamsTable* lea_broadcast_params_table);
#else
#define KymeraBroadcastConcurrency_InitializeLeaBroacastParams(lea_broadcast_params_table) \
        (UNUSED(lea_broadcast_params_table))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Set the LE audio broadcasting status.

    \param[in] is_broadcasting_enabled Set the broadcasting status based on enable/disable request.
*/
void KymeraBroadcastConcurrency_SetLeAudioBroadcastingStatus(bool is_broadcasting_enabled);
#else
#define KymeraBroadcastConcurrency_SetLeAudioBroadcastingStatus(is_broadcasting_enabled) \
        (UNUSED(is_broadcasting_enabled))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Get the LE audio broadcasting status.

    \returns bool is_audio_broadcasting status.
*/
bool KymeraBroadcastConcurrency_GetLeAudioBroadcastingStatus(void);
#else
#define KymeraBroadcastConcurrency_GetLeAudioBroadcastingStatus() (FALSE)
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Set the LE audio broadcast role.

    \returns broadcast_role Indicates the broadcaster role to be set.
*/
void KymeraBroadcastConcurrency_SetLeAudioBroadcastRole(appKymeraLeAudioBroadcastRoles broadcast_role);
#else
#define KymeraBroadcastConcurrency_SetLeAudioBroadcastRole(broadcast_role) (UNUSED(role))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Get the LE audio broadcast role.

    \returns broadcast_role provides the broadcast role info.
*/
appKymeraLeAudioBroadcastRoles KymeraBroadcastConcurrency_GetLeAudioBroadcastRole(void);
#else
#define KymeraBroadcastConcurrency_GetLeAudioBroadcastRole() (KYMERA_LE_AUDIO_BROADCAST_ROLE_NONE)
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Set the LE audio broadcast role.

    \returns broadcast_role Indicates the broadcaster role to be set.
*/
void KymeraBroadcastConcurrency_SetBroadcastSourceReconfigurationStatus(bool reconfiguration_status);
#else
#define KymeraBroadcastConcurrency_SetBroadcastSourceReconfigurationStatus(reconfiguration_status) \
        (UNUSED(reconfiguration_status))
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#if defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER)
/*! \brief Get the LE audio broadcast role.

    \returns broadcast_role provides the broadcast role info.
*/
bool KymeraBroadcastConcurrency_GetBroadcastSourceReconfigurationStatus(void);
#else
#define KymeraBroadcastConcurrency_GetBroadcastSourceReconfigurationStatus (FALSE)
#endif /* defined(INCLUDE_LE_AUDIO_BROADCAST_SOURCE) && defined(ENABLE_SIMPLE_SPEAKER) */

#endif // KYMERA_BROADCAST_CONCURRENCY_H
